"use strict";
module.exports = {
	/**
	 * 编辑待办
	 * @url client/todo/kh/editTodo 前端调用的url参数地址
	 * data 请求参数
	 * @param {String} params1  参数1
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, filterResponse, originalParam } = event;
		let { customUtil, uniID, config, pubFun, vk, db, _, $ } = util;
		let { uid } = data;
		// 业务逻辑开始-----------------------------------------------------------
		if (!data.title) return { code: -1, msg: "标题不能为空" };
		if (!data.classification_id) return { code: -1, msg: "分类不能为空" };
		const res = await vk.baseDao.updateById({
			dbName: "dfb-todo",
			id: data._id,
			dataJson: {
				title: data.title,
				content: data.content,
				classification_id: data.classification_id,
			},
			getUpdateData: false,
		});
		// 业务逻辑结束-----------------------------------------------------------
		if (!res) return { code: -1, msg: "修改失败" };
		return { code: 0, msg: "修改成功" };
	},
};